//
//  ChinaArea.m
//  10803
//
//  Created by student on 16/2/24.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ChinaArea.h"
static ChinaArea *instance=nil;
@interface ChinaArea()

@property(nonatomic,strong)NSArray *provinces;
@property(nonatomic,strong)NSMutableArray *citys;
@property(nonatomic,strong)NSMutableArray *smallcitys;
@property(nonatomic,strong)NSArray *arr;
@property(nonatomic,strong)NSArray *city;
//@property(nonatomic,strong)NSMutableArray *s;
@end
@implementation ChinaArea
+(ChinaArea *)shareareas
{
    if(instance==nil)
    {
        instance=[[ChinaArea alloc]init];
    }
    return  instance;
}
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        NSString *path=[[NSBundle mainBundle]pathForResource:@"area1" ofType:@"plist"];
        self.provinces=[NSArray arrayWithContentsOfFile:path];
        self.smallcitys=[[NSMutableArray alloc]init];
        self.citys=[[NSMutableArray alloc]init];
        self.city=[[NSArray alloc]init];
        self.arr=[[NSArray alloc]init];
        for(int i=0;i<self.provinces.count;i++)
        {
            NSDictionary *dic=[[NSDictionary alloc]init];
            dic=self.provinces[i];
            [self.citys addObject:dic[@"State"]];
            self.arr=dic[@"Cities"];
            [self.smallcitys addObject:self.arr];
            
        }
        
    }
    return self;
}

+(NSArray *)provinces
{
    ChinaArea *s=[ChinaArea shareareas];
    return s.citys;
}
+(NSArray *)cisForProvince:(int)city
{
    ChinaArea *s=[ChinaArea shareareas];
    
    s.city=s.smallcitys[city];
    for(int i=1;i<s.city.count;i++)
    {
        NSLog(@"%@",s.city);
    }
    return  s.city;
}

@end
